package cn.itcast.demo;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;

public class FastDFSTest {
	
	public static void main(String[] args) throws Exception {
		//加载配置文件
		ClientGlobal.init("D:\\eclipse-workspace\\fastDFS\\src\\main\\resources\\fdfs_client.conf");
		
		//创建tracker客户端
		TrackerClient trackerClient = new TrackerClient();
		
		//连接tracker服务端
		TrackerServer trackerServer = trackerClient.getConnection();
		
		//声明存储服务端
		StorageServer storageServer=null ;
		
		//获取存储服务端对象的客户端对象
		StorageClient storageClient = new StorageClient(trackerServer,storageServer);
		
		//上传文件
		String[] strings = storageClient.upload_file("C:\\Users\\Administrator\\Desktop\\a.jpg","jpg",null);
		
		for (String string : strings) {
			System.out.println(string);
		}
		//group1
		//M00/00/00/wKgZhVyxNy-ATB5qAAC3Ml029Do642.jpg
		
		
		
	}
}
